package com.interauto.bean.autoenum;

import java.util.HashMap;
import java.util.Map;

public enum AutoExpectEnum {
    AssertEquals("1","assertEquals"), //校验是否相等
    AssertContains("2","assertContains"), //校验是否包含
    AssertHaskey("3","assertHaskey"),
    AssertEqunum("4","assertEqunum"),
    AssertArrEqunum("5","assertArrEqunum"),
    AssertLsunum("6","assertLsunum"), //判断小于,即校验值是否<期望值
    AssertGrunum("7","assertGrunum"), //判断大于
    AssertArrLsunum("8","assertArrLsunum"), //判断小于
    AssertArrGrunum("9","assertArrGrunum"), //判断大于
    AssertIsNotEmpty("10","assertIsNotEmpty"); //判断是否不为空

    private String checktype;
    private String checkname;
    private static Map<Integer,AutoExpectEnum> enummap=new HashMap<>();


    AutoExpectEnum(String checktype, String checkname) {
        this.checktype = checktype;
        this.checkname = checkname;
    }

    public static Map<String,String> getAutoExpectMap(){
        Map<String,String> maps=new HashMap<>();
        for(AutoExpectEnum expectEnum: AutoExpectEnum.values()){
            maps.put(expectEnum.getChecktype(),expectEnum.getCheckname());
        }
        return maps;
    }

    public static AutoExpectEnum getAutoExpectEnum(Integer typeid){
        if(enummap.containsKey(typeid)){
            return enummap.get(typeid);
        }
        for(AutoExpectEnum expectEnum: AutoExpectEnum.values()){
            enummap.put(Integer.valueOf(expectEnum.getChecktype()),expectEnum);
        }
        return enummap.get(typeid);
    }

    public String getChecktype() {
        return checktype;
    }

    public void setChecktype(String checktype) {
        this.checktype = checktype;
    }

    public String getCheckname() {
        return checkname;
    }

    public void setCheckname(String checkname) {
        this.checkname = checkname;
    }
}
